<template>
    <div>
        <div class="banner" @click="openGallary">
            <img class="banner-img" :src="bannerImg" alt="">
            <div class="banner-info">
                <div class="banner-title">
                    {{sightName}}
                </div>
                <div class="banner-number">
                    <span class="iconfont">&#xe631;</span>
                    <span>{{gallaryImgs.length}}</span>
                    <!-- 39 -->
                </div>
            </div>
        </div>
        <fade-animate>
            <common-gallary :imgs="gallaryImgs" v-show="showImgs" @close="handleGallaryClose"></common-gallary>
        </fade-animate>
    </div>
</template>

<script>
import CommonGallary from 'common/gallary/Gallary'
import FadeAnimate from 'common/fade/Fade'
export default {
  name: 'detailBanner',
  props: {
    sightName: String,
    bannerImg: String,
    gallaryImgs: Array
  },
  components: {
    CommonGallary,
    FadeAnimate
  },
  data () {
    return {
      showImgs: false
    }
  },
  methods: {
    openGallary () {
      this.showImgs = true
    },
    handleGallaryClose () {
      this.showImgs = false
    }
  }
}
</script>

<style scoped>
.banner{
    overflow: hidden;
    height: 0;
    padding-bottom: 55%;
    position: relative;
}
.banner-img{
    width: 100%;
}
.banner-info{
    position: absolute;
    bottom: 0px;
    left: 0;
    right: 0;
    line-height: 1.4rem;
    display: flex;
    background-image: -webkit-gradient(linear,left top,left bottom, from(rgba(0,0,0,0)),to(rgba(0,0,0,0.8)));
}
.banner-title{
    flex: 1;
    color: #fff;
    font-size: .95rem;
    font-weight: 500;
    text-align: left;
    text-indent: .6em;
}
.banner-number{
    padding: 0 1.2rem;
    line-height: 1.2rem;
    height: 1.2rem;
    border-radius: .6rem;
    background: rgba(0,0,0,.8);
    color: #fff;
    font-size: .95rem;
    font-weight: 500;
    margin-right: 8px;
}
</style>
